package service.Impl;

import dao.BookDao;

import dao.Impl.BookDaoImpl;
import entry.Book;
import service.BookService;
import util.PageHelper;

import java.util.ArrayList;

public class BookServiceImpl implements BookService {

    private BookDao bookDao = new BookDaoImpl();

    @Override
    public ArrayList<Book> getBooks() {
        return bookDao.getBooks();
    }

    @Override
    public boolean insertBook(Book book) {
        return bookDao.insertBook(book) == 0 ? false : true;
    }

    @Override
    public ArrayList<Book> selectBook(Book book, PageHelper pageHelper) {
        return bookDao.selectBook(book, pageHelper);
    }

    @Override
    public boolean deleteBook(Book book) {
        return bookDao.deleteBook(book) == 0 ? false : true;
    }

    @Override
    public boolean updateBook(Book book) {
        return bookDao.updateBook(book) == 0 ? false : true;
    }

    @Override
    public Book selectBookById(int id) {
        return bookDao.selectBookById(id);
    }

    @Override
    public boolean deleteBook1(int id) {
        return bookDao.deleteBook1(id);
    }

    @Override
    public int selectBookSize(Book book) {
        return bookDao.selectBookSize(book);
    }
}
